<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {
    $error = false;

    $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
    $email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
    $enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

    if (!tep_validate_email($email_address)) {
      $error = true;

      $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    }

    $actionRecorder = new actionRecorder('ar_contact_us', (tep_session_is_registered('customer_id') ? $customer_id : null), $name);
    if (!$actionRecorder->canPerform()) {
      $error = true;

      $actionRecorder->record(false);

      $messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15)));
    }

    if ($error == false) {
      tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

      $actionRecorder->record();

      tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
    }
  }

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));

  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<?php
  if ($messageStack->size('contact') > 0) {
    echo $messageStack->output('contact');
  }

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
<div style="text-align:left; color:#FFF">
	  <?php echo nl2br(TEXT_SUCCESS); ?>
</div>
<?php
  } else {
?>
<style>
table.contact{}
table.contact input{color:#fff;}
table.contact textarea{color:#fff;}
</style>
<div id="left" style="width:520px;">
<div class="contact">
    <h1 class="left_title" style="border:none;">CONTACTGEGEVENS</h1>
        <div id="info_contact" class="contact_image" style="background-position: 275px;">
            <div id="table">
            <table align="left" border="0" cellpadding="0" cellspacing="0" width="260">
                <tbody><tr>
                    <td align="left" valign="top"><span>Adres:</span></td>
                    <td align="left" valign="top">Rijselstraat 70<br>8930 Menen</td>
                </tr>
                <tr>
                    <td align="left"><span>Tel:</span></td>
                    <td align="left">+32 (0)56 293 837</td>
                </tr>
                <tr>
                    <td align="left"><span>Fax:</span></td>
                    <td align="left">056 29 54 95</td>
                </tr>
                <tr>
                    <td align="left"><span>GSM:</span></td>
                    <td align="left">+32 (0)484 227 741</td>
                </tr>
                <tr>
                    <td align="left"><span>E-mail:</span></td>
                    <td align="left">info@melanting.be</td>
                </tr>
                <tr>
                    <td align="left"><span>Website:</span></td>
                    <td align="left">www.melanting.be</td>
                </tr>
            </tbody></table>
            </div>
    	</div>
    <div id="contact_form">
       <h1 style="border-bottom: medium none; color: rgb(252, 185, 24); margin: 0pt 0pt 10px; padding-bottom: 5px; position: relative; text-align: left; width: 290px;">CONTACT FORMULIER</h1>
       <?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', '', true); ?>
        <table cellpadding="1" cellspacing="1" width="517px" class="contact">
            <tbody><tr align="left"><td align="left">Je naam (verplicht) </td></tr>
            <tr align="left">
            	<td><input name="name" id="name" class="required" type="text"></td>
            </tr>
            <tr align="left">
                <td align="left"> Je email (verplicht) </td>
            </tr>
            <tr align="left">
                <td><input name="email" id="email" class="required email" type="text"></td>
            </tr>
            <tr align="left">
                <td align="left"> Onderwerp (verplicht) </td>
            </tr>
            <tr align="left">
                <td><input name="onderwerp" id="onderwerp" class="required" type="text"></td>
            </tr>
            <tr align="left">
                <td align="left"> Je bericht (verplicht) </td>
            </tr>
            <tr align="left">
            	<td><textarea cols="" rows="5" name="bericht" class="required"></textarea></td>
            </tr>
            <tr align="left">
            	<td align="left"><input value="Verstuur" id="bt" type="submit"></td>
            </tr>
       </tbody></table>
       </form>
    </div>  
</div>
</div><!--end #left -->

<div id="right" style="width:410px;">
    <div class="moduletable">
    <div id="openingsuren">
        <div class="openingsuren_TL_corner">
            <div class="openingsuren_BR_corner">
                <table border="0" class="openingsuren">
                    <tr>
                        <td width="25px">&nbsp;</td>
                        <td colspan="4"><h1><?=TEXT_HEADING_HOURS; ?></h1></td>
                    </tr>
<?php
$hours_sql = tep_db_query("select phd.title, phd.time_1, phd.time_2 from " . TABLE_PAGES_HOURS . " ph inner join " . TABLE_PAGES_HOURS_DESCRIPTION . " phd on (ph.pages_hours_id = phd.pages_hours_id) where phd.language_id = '" . (int)$languages_id ."' order by ph.sort_order, ph.pages_hours_id");
while($hours = tep_db_fetch_array($hours_sql)) {
?>
                    <tr align="left">
                        <td>&nbsp;</td>
                        <td width="95px" align="left"><?php echo $hours['title']; ?></td>
                        <td width="120px" align="left"><?php echo $hours['time_1']; ?></td>
                        <td width="115px" align="left"><?php echo $hours['time_2']; ?></td>
                        <td width="20px">&nbsp;</td>
                    </tr>
<?php
}
?>
                </table>
                <div class="clear"></div>
            </div>
        </div>
    </div>		
	</div>
    <div class="moduletable">
    	<h1 style=" clear:both; width:410px; ">&bull; LIGGING</h1><br />
		<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript">
        $(document).ready(function() {
			var mapDiv = document.getElementById('map3');
			var latLng = new google.maps.LatLng(50.7934, 3.1226);
			var map = new google.maps.Map(mapDiv, {
			  center: latLng,
			  zoom: 13,
			  mapTypeId: google.maps.MapTypeId.ROADMAP
			});
			var marker = new google.maps.Marker({
			  position: latLng,
			  map: map
			});
			var infowindow = new google.maps.InfoWindow({ content: '' });
			google.maps.event.addListener(marker, 'click', function() {
				infowindow.open(map, marker);
			});
		});
        </script>
    
        <div id="map3" style="width: 410px; height: 400px; border: 1px solid rgb(119, 119, 119); overflow: hidden; position: relative; background-color: rgb(229, 227, 223);"></div>
    </div>
</div>

<?php
  }

  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
